#ifndef __Weapon_h_
#define __Weapon_h_

#include "Item.h"
#include "MovableItem.h"

class Bullet;

class Weapon : public Item, public Ogre::FrameListener
{

	friend class GameManager;

	// Attributes ------------------------------------------------------------------------------
public:
	enum WeaponType
	{
		SNOW, 
		ICE, 
		WATER,
		BUG
	};
	enum WeaponLevel 
	{
		LEVEL1, 
		LEVEL2
	};
	static const char* DEFAULT_NODE_NAME;

protected:
	Ogre::Real repetitionTime;
	Ogre::Real mTimeUntilDestruction;
	std::vector<Bullet*> unusedBullets;
	WeaponType type;
	WeaponLevel level;

	static int ID;
	static const char* DEFAULT_NAME;

	// Methods ---------------------------------------------------------------------------------
protected:
	Weapon(WeaponType _type, WeaponLevel _level);
	virtual void initialize();
	virtual ~Weapon();

public:
	virtual void collision(Item* _item);
	virtual void collisionWithBullet(Bullet* _bullet);
	virtual void collisionWithEnemy(Enemy* _enemy);
	virtual void collisionWithMainCharacter(MainCharacter* _mainCharacter);
	virtual void collisionWithFish(Fish * _fish);
	virtual void collisionWithBonus(Bonus* _bonus);
	virtual void collisionWithWeapon(Weapon* weapon);
	virtual bool frameStarted(const Ogre::FrameEvent& evt);

	Bullet* createBullet(const Ogre::Vector3& startPosition);
	void destroyBullet(Bullet* _bullet);

	const Ogre::Real& getRepetitionTime() const { return repetitionTime; }

	const WeaponType& getWeaponType() const { return type; }
	const WeaponLevel& getWeaponLevel() const { return level; }
};

#endif